package the.world.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import the.world.bean.MessageList;
import the.world.bean.SortStategy;
import the.world.mapper.ListMapper;
import the.world.service.ListService;

import java.util.List;
@Service
public class ListServiceImpl implements ListService {
    @Autowired
    private ListMapper listMapper;

    @Override
    public List<MessageList> listAllByOption(int currentPage,int pageSize) {
        int offset = (currentPage - 1) * pageSize;
        return listMapper.listAllByOption(offset,pageSize);
    }

    @Override
    public List<SortStategy> listAllByList() {
        return listMapper.listAllByList();
    }

    @Override
    public List<MessageList> selectByStrategyId(int currentPage,int pageSize, int id) {
        int offset = (currentPage - 1) * pageSize;
        return listMapper.selectByStrategyId(offset,pageSize,id);
    }

    @Override
    public List<MessageList> selectByName(int currentPage, int pageSize, String value) {
        return listMapper.selectByName(currentPage,pageSize,value);
    }

    @Override
    public int totalCount() {
        return listMapper.totalCount();
    }
}
